#include<iostream>
#include<vector>

using namespace std;

vector<vector<string>> v;

int main(){
	freopen("input.txt","r",stdin);
	for(int i=0;i<3;i++){
		string s;
		getline(cin,s);
		int j=0,k=0;vector<string> r;
		while(j<s.length()){
			if(s[j]=='['){
				while(k++<s.length()){
					if(s[k]==']'){
						r.push_back(s.substr(j+1,k-j-1));
						break;
					}
				}
			}j++;
		}
		v.push_back(r);
	}
	int n;
	cin>>n;
	while(n--){
		int l_s,l_y,k,r_y,r_s;
		cin>>l_s>>l_y>>k>>r_y>>r_s;
		if(l_s>v[0].size()||l_y>v[1].size()||k>v[2].size()||
			r_y>v[1].size()||r_s>v[0].size()||
			l_s<1||l_y<1||k<1||r_s<1||r_y<1){
			cout<<"Are you kidding me? @\\/@"<<endl;
		}else{
		cout<<v[0][l_s-1]<<"("<<v[1][l_y-1]<<v[2][k-1]<<v[1][r_y-1]<<")"<<v[0][r_s-1]<<endl;
		}
	}
}
